home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / trigon.cpp < prev    next >
C/C++ Source or Header  |  1994-11-20  |  445b  |  20 lines

  1. #include "trigon.h"
  2. #include <math.h>
  3.  
  4. Trigonometry::Trigonometry()
  5.     {
  6.     sin_table = new int[362];
  7.     for(double i = 0; i < 360; i++)
  8.     sin_table[i] = (int)(1000 * ::sin(M_PI * 2 * i / 360));
  9.     sin_table[360] = 0;
  10.     }
  11. ////////////////////////
  12. int Trigonometry::sin(int alpha)
  13.     {
  14.     while(alpha > 360)
  15.     alpha -= 360;
  16.     while(alpha < 0)
  17.     alpha += 360;
  18.     return sin_table[alpha];
  19.     }
  20. //////////////////////////